Skip to content

Add inlined documentation about state transitions#388

Open
yacovm wants to merge 3 commits into
mainfrom
MSM-ASCII
Open

Add inlined documentation about state transitions#388
yacovm wants to merge 3 commits into
mainfrom
MSM-ASCII

Conversation

@yacovm
Copy link
Copy Markdown
Collaborator

@yacovm yacovm commented May 20, 2026

No description provided.

yacovm added 3 commits May 19, 2026 23:17
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Also self-sign during aggregation

- Introduces ApprovalStore (msm/approvals.go) — an in-memory store of validator approvals for epoch transitions, keyed by (NodeID, PChainHeight). It verifies BLS signatures on
  ingest, deduplicates by timestamp (newer wins, older is dropped), and prunes per-node entries to at most len(validators) by evicting the oldest timestamp.
- Adds Timestamp to ValidatorSetApproval (msm/encoding.go) so the store can order/evict approvals deterministically.
- computeNewApprovals (msm/msm.go) now optimistically self-signs the next epoch's P-chain reference height each round and appends its own ValidatorSetApproval to the peer set since the store deduplicates it later.

Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
@yacovm yacovm changed the title Msm ascii Add inlined documentation about state transitions May 20, 2026
samliok
samliok previously approved these changes May 22, 2026
Copy link
Copy Markdown
Collaborator

@samliok samliok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realllly like the FSA defined above the state variable. It's clear, and easy to follow. 🎸

I'm concerned that larger comments above the buildBlock... functions will be hard to maintain / get out of sync. I dont think the logic will change much so I think its fine, but they are bulkier function comments that are probably hard to edit manually in the future.

Although claude code can be prompted to do so and it'll do a good job of keeping the formatting.

@samliok samliok dismissed their stale review May 22, 2026 19:46

can we seperate out the comments like the FSA into its own PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants